﻿using System.Collections.Generic;
using WUDI.ECharts;
using WUDI.ECharts.Series.Bar;
using WUDI.ECharts.Timeline;
using WUDI.ECharts.XAxis;
using WUDI.ECharts.YAxis;

namespace EChartsApp
{
    class Program
    {
        static void Main(string[] args)
        {
            EChartsOption option = new EChartsOption()
            {
                tooltip = new WUDI.ECharts.Tooltip.Tooltip()
                {
                    trigger = Trigger.axis,
                    axisPointer = new WUDI.ECharts.Tooltip.AxisPointer.AxisPointer()
                    {
                        type = AxisPointerType.shadow
                    },
                },
                legend = new WUDI.ECharts.Legend.Legend()
                {
                    data = new List<object>()
                    {
                        "直接访问", "邮件营销", "联盟广告", "视频广告", "搜索引擎", "百度", "谷歌", "必应", "其他"
                    },
                },
                grid = new WUDI.ECharts.Grid.Grid()
                {
                    left = "3%",
                    right = "4%",
                    bottom = "3%",
                    containLabel = true
                },
                xAxis = new XAxis()
                {
                    type = XAxisType.category,
                    data = new List<object>()
                    {
                        "周一", "周二", "周三", "周四", "周五", "周六", "周日"
                    }
                },
                yAxis = new YAxis()
                {
                    type = XAxisType.value
                },
                series = new List<object>()
                {
                    new Bar()
                    {
                        name="直接访问",
                        data= new List<object>()
                        {
                            320, 332, 301, 334, 390, 330, 320
                        }
                    },
                    new Bar()
                    {
                        name="邮件营销",
                        stack="广告",
                        data= new List<object>()
                        {
                            120, 132, 101, 134, 90, 230, 210
                        }
                    },
                    new Bar()
                    {
                        name="联盟广告",
                        stack="广告",
                        data= new List<object>()
                        {
                            220, 182, 191, 234, 290, 330, 310
                        }
                    },
                     new Bar()
                    {
                        name="视频广告",
                         stack="广告",
                         data= new List<object>()
                        {
                           150, 232, 201, 154, 190, 330, 410
                        }
                    },
                    new Bar()
                    {
                        name="搜索引擎",
                        data= new List<object>()
                        {
                           862, 1018, 964, 1026, 1679, 1600, 1570
                        },
                        markLine = new WUDI.ECharts.Series.Bar.MarkLine.MarkLine()
                        {
                            lineStyle = new WUDI.ECharts.Series.Bar.MarkLine.LineStyle.LineStyle()
                            {
                                 type= LineStyleType.dashed,
                            },

                        }
                    },
                     new Bar()
                    {
                        name="百度",
                        barWidth=5,
                         stack="搜索引擎",
                         data= new List<object>()
                        {
                           620, 732, 701, 734, 1090, 1130, 1120
                        }
                    },
                    new Bar()
                    {
                        name="谷歌",
                         stack="搜索引擎",
                         data= new List<object>()
                        {
                           120, 132, 101, 134, 290, 230, 220
                        }
                    },
                    new Bar()
                    {
                        name="必应",
                         stack="搜索引擎",
                         data= new List<object>()
                        {
                          60, 72, 71, 74, 190, 130, 110
                        }
                    },
                    new Bar()
                    {
                        name="其他",
                         stack="搜索引擎",
                         data= new List<object>()
                        {
                          62, 82, 91, 84, 109, 110, 120
                        }
                    },
                }
            };

            //https://www.echartsjs.com/examples/zh/editor.html?c=bar-stack


            var json = option.ToEChartJson();
        }
    }
}
